package com.cavy.platform.server.dto;

import com.cavy.platform.server.domain.AbstractConfigMap;
import com.cavy.platform.server.domain.ConfigMapType;
import com.cavy.platform.server.domain.StringConfigMap;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.NotBlank;

@EqualsAndHashCode(callSuper = true)
@Data
public class StringConfigMapCreateDto
        extends AbstractConfigMapCreateDto {

    @NotBlank(message = "值不能为空")
    private String mapValue;

    public StringConfigMapCreateDto() {
        mapType = ConfigMapType.STRING;
    }

    @Override
    public void setValue(AbstractConfigMap configMap) {
        super.setValue(configMap);
        StringConfigMap map = (StringConfigMap) configMap;
        map.setValue(mapValue);
    }
}
